using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using hao_Model;
using hao_Dto.User;
using hao_Common.Dapper.Repository;

namespace hao_Reppsitory.User
{
    /// <summary>
    /// 地址仓储接口
    /// </summary>
    public interface IAddressRepository
    {
        /// <summary>
        /// 根据ID获取地址
        /// </summary>
        Task<Address> GetByIdAsync(Guid id);

        /// <summary>
        /// 添加地址
        /// </summary>
        Task AddAsync(Address address);

        /// <summary>
        /// 更新地址
        /// </summary>
        Task UpdateAsync(Address address);

        /// <summary>
        /// 删除地址
        /// </summary>
        Task DeleteAsync(Guid id);
        /// <summary>
        /// 根据用户ID获取地址列表
        /// </summary>
        Task<List<Address>> GetAddressesByUserIdAsync(Guid userId);

        /// <summary>
        /// 获取用户的默认地址
        /// </summary>
        Task<Address> GetDefaultAddressByUserIdAsync(Guid userId);

        /// <summary>
        /// 设置默认地址（会将其他地址设为非默认）
        /// </summary>
        Task<bool> SetDefaultAddressAsync(Guid userId, Guid addressId);

        /// <summary>
        /// 分页搜索地址
        /// </summary>
        Task<(List<Address> addresses, int totalCount)> SearchAddressesAsync(AddressSearchDto searchDto);

        /// <summary>
        /// 检查用户是否已有默认地址
        /// </summary>
        Task<bool> HasDefaultAddressAsync(Guid userId);

        /// <summary>
        /// 批量删除地址
        /// </summary>
        Task<bool> BatchDeleteAsync(List<Guid> addressIds);

        /// <summary>
        /// 获取地址区域统计
        /// </summary>
        Task<List<AddressRegionStatsDto>> GetRegionStatsAsync();

        /// <summary>
        /// 根据区域获取地址数量
        /// </summary>
        Task<int> GetAddressCountByRegionAsync(string province, string city, string district);

        /// <summary>
        /// 软删除地址
        /// </summary>
        Task<bool> SoftDeleteAsync(Guid addressId);

        /// <summary>
        /// 检查地址是否属于指定用户
        /// </summary>
        Task<bool> CheckAddressOwnershipAsync(Guid addressId, Guid userId);
    }
}